home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WMENUITM.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  4.5 KB  |  166 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WMenuItem -- Wrapper for the Windows 95 Menu item control.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *      Click --
  19.  *
  20.  *      Select --
  21.  *
  22.  *       MeasureItem --
  23.  *
  24.  *       DrawItem --
  25.  *
  26.  *************************************************************************/
  27.  
  28. #ifndef _WMENUITM_HPP_INCLUDED
  29. #define _WMENUITM_HPP_INCLUDED
  30.  
  31. #ifndef _WNO_PRAGMA_PUSH
  32. #pragma pack(push,8);
  33. #pragma enum int;
  34. #endif
  35.  
  36. #ifndef _WOBJECT_HPP_INCLUDED
  37. #  include "wobject.hpp"
  38. #endif
  39. #ifndef _WSTRING_HPP_INCLUDED
  40. #  include "wstring.hpp"
  41. #endif
  42. #ifndef _WMENU_HPP_INCLUDED
  43. #  include "wmenu.hpp"
  44. #endif
  45. #ifndef _WBITMAP_HPP_INCLUDED
  46. #  include "wbitmap.hpp"
  47. #endif
  48.  
  49. class WMenuItem;
  50.  
  51. enum WMenuItemType {
  52.     WTextMenuItem               = 0x0000,
  53.     WBitmapMenuItem             = 0x0040,
  54.     WOwnerDrawnMenuItem         = 0x0100,
  55. };
  56.  
  57. class WCMCLASS WMenuItem : public WMenuObject {
  58.     WDeclareSubclass( WMenuItem, WMenuObject );
  59.  
  60.     public:
  61.  
  62.         /**********************************************************
  63.          * Constructors and Destructors
  64.          *********************************************************/
  65.  
  66.         WMenuItem();
  67.         WMenuItem( WUShort id, const WChar *text=NULL,
  68.                    const WChar *htext=NULL,
  69.                    WMenuItemType type=WTextMenuItem );
  70.     
  71.         ~WMenuItem();
  72.  
  73.         /**********************************************************
  74.          * Properties
  75.          *********************************************************/
  76.  
  77.         // Bitmap
  78.  
  79.         WBitmap GetBitmap() const;
  80.         WBool   SetBitmap( const WBitmap & bitmap );
  81.  
  82.         // CheckedBitmap
  83.  
  84.         WBitmap GetCheckedBitmap() const;
  85.         WBool   SetCheckedBitmap( const WBitmap & bitmap );
  86.  
  87.         // Checked
  88.  
  89.         WBool GetChecked() const;
  90.         WBool SetChecked( WBool checked, WBool exclusive=FALSE );
  91.  
  92.         // Default
  93.         //
  94.         //    If TRUE, the menu item is displayed as the default menu
  95.         //    item (bolded under Win95).
  96.  
  97.         WBool GetDefault() const;
  98.         WBool SetDefault( WBool isDefault );
  99.  
  100.         // Enabled
  101.  
  102.         WBool GetEnabled() const;
  103.         WBool SetEnabled( WBool enabled, WBool grayIfDisabled=TRUE );
  104.  
  105.         // Grayed
  106.  
  107.         WBool GetGrayed() const;
  108.         WBool SetGrayed( WBool grayed );
  109.  
  110.         // Type
  111.  
  112.         WMenuItemType GetType() const;
  113.         WBool         SetType( WMenuItemType type );
  114.  
  115.         // UncheckedBitmap
  116.  
  117.         WBitmap GetUncheckedBitmap() const;
  118.         WBool   SetUncheckedBitmap( const WBitmap & bitmap );
  119.  
  120.         /**********************************************************
  121.          * Methods
  122.          *********************************************************/
  123.  
  124.         // OnClick
  125.  
  126.         virtual WBool OnClick();
  127.  
  128.         // OnSelected
  129.  
  130.         virtual WBool OnSelected( WBool selected=TRUE );
  131.  
  132.         /**********************************************************
  133.          * Others
  134.          *********************************************************/
  135.  
  136.         int operator==( const WMenuItem & obj ) const;
  137.         int operator!=( const WMenuItem & obj ) const;
  138.  
  139.         /**********************************************************
  140.          * Overrides
  141.          *********************************************************/
  142.  
  143.         // Text
  144.  
  145.         virtual WString GetText();
  146.         virtual WBool   SetText( const WString & text );
  147.  
  148.         /**********************************************************
  149.          * Data members
  150.          *********************************************************/
  151.  
  152.     private:
  153.  
  154.         WBitmap *               _bitmap;
  155.         WBitmap *               _checkedBitmap;
  156.         WBitmap *               _uncheckedBitmap;
  157.         WMenuItemType           _type;
  158. };
  159.  
  160. #ifndef _WNO_PRAGMA_PUSH
  161. #pragma enum pop;
  162. #pragma pack(pop);
  163. #endif
  164.  
  165. #endif // _WMENUITM_HPP_INCLUDED
  166.